<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      //then的返还值
      // 一、onResolved的返还值
      // 二、onRejected的返还值
      let p = new Promise((resolve, reject) => {
        resolve("success");
      });

      let result = p.then(
        (res) => {
        //   return new Promise((resolve, reject) => {
        //     resolve("返回成功的promise");
        //   });
        throw new Error("错误了");
        },
        (err) => {
            return 111
        }
      );
      console.log(result);

      result.then(
        (res) => {
          console.log("成功了", res);
        },
        (err) => {
          console.log("失败了", err);
        }
      );
    </script>
  </body>
</html>
